package com.keensense.vcm.model;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import com.keensense.vcm.model.enums.SortEnum;

/**
 * @author lanjian
 * @date 2020/5/7 7:40 下午
 */
@XmlRootElement(name = "request")
@XmlAccessorType(XmlAccessType.FIELD)
public class QueryProfileLibrariesRequest {

    private QueryProfileLibrariesRequest() {}

    public QueryProfileLibrariesRequest(Page page) {
        this.page = page;
    }

    /**
     * 档案库id，唯一标识一个库，传入该参数会忽略其他检索条件，可传入最多20个，以英文逗号分隔
     */
    @XmlElement
    private String aId;

    /**
     * 档案库的名字
     */
    @XmlElement
    private String name;
    /**
     * 创建开始的时间戳
     */
    @XmlElement
    private Long startTime;

    /**
     * 创建结束的时间戳
     */
    @XmlElement
    private Long endTime;

    /**
     * 用户自定义标签
     */
    @XmlElement
    private String tag;

    @XmlElement
    private Page page;

    public void setaId(String aId) {
        this.aId = aId;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setStartTime(Long startTime) {
        this.startTime = startTime;
    }

    public void setEndTime(Long endTime) {
        this.endTime = endTime;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }

    public void setPage(Page page) {
        this.page = page;
    }

    public static class Page {

        public Page(Integer no, Integer size) {
            this.no = no;
            this.size = size;
        }

        /**
         * 第几页，为正整数
         */
        @XmlElement
        private Integer no;
        /**
         * 每页条数，范围[1,1000]
         */
        @XmlElement
        private Integer size;

        /**
         * 升序，asc，降序，desc，默认为降序
         */
        private SortEnum sort;

        /**
         * 排序名称，支持的字段:name、cTime、uTime、tag，默认为name
         */
        private OrderNameEnum orderName;

        public void setNo(Integer no) {
            this.no = no;
        }

        public void setSize(Integer size) {
            this.size = size;
        }

        public void setSort(SortEnum sort) {
            this.sort = sort;
        }

        public void setOrderName(OrderNameEnum orderName) {
            this.orderName = orderName;
        }
    }

    public enum OrderNameEnum {
        name, cTime, uTime, tag
    }


    public String getaId() {
        return aId;
    }

    public String getName() {
        return name;
    }

    public Long getStartTime() {
        return startTime;
    }

    public Long getEndTime() {
        return endTime;
    }

    public String getTag() {
        return tag;
    }

    public Page getPage() {
        return page;
    }
}
